package com.baizhi.service.impl;

import com.baizhi.dao.OrderDao;
import com.baizhi.entity.Order;
import com.baizhi.service.OrderService;
import com.baizhi.util.MyBatisUtil;

public class OrderServiceImpl implements OrderService{
	private OrderDao od = null;
	@Override
	public int insertOrder(Order order) {
		od = MyBatisUtil.getMapper(OrderDao.class);
		int i = od.insertOrder(order);
		int a = 0;
		if(i>0){
			//添加成功
			a = order.getOrderid();
			if(a != 0){
				MyBatisUtil.commit();
			}
		}else{
			//添加失败
			MyBatisUtil.rollback();
		}
		return a;
	}

}
